* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    line-height: 1.6;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.container {
    width: 100%;
    max-width: 800px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    margin-top: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

header {
    background: rgba(44, 62, 80, 0.8);
    color: white;
    padding: 20px;
    text-align: center;
    backdrop-filter: blur(5px);
}

h1 {
    margin-bottom: 10px;
    font-size: 24px;
}

.status-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 10px;
}

.status {
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    background-color: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.connected {
    background-color: rgba(46, 204, 113, 0.3);
    color: white;
}

.disconnected {
    background-color: rgba(231, 76, 60, 0.3);
    color: white;
}

.testing {
    background-color: rgba(243, 156, 18, 0.3);
    color: white;
}

.chat-container {
    display: flex;
    flex-direction: column;
    height: 700px;
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: rgba(248, 249, 250, 0.3);
}

.message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    line-height: 1.4;
    animation: fadeIn 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    background-color: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(5px);
    border: 2px solid;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.message-content {
    flex: 1;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.user-message {
    align-self: flex-end;
    color: #3498db;
    border-bottom-right-radius: 4px;
    border-color: #3498db;
    background-color: rgba(52, 152, 219, 0.2);
}

.bot-message {
    align-self: flex-start;
    color: #333;
    border-bottom-left-radius: 4px;
    border-color: #e0e0e0;
    background-color: rgba(255, 255, 255, 0.5);
}

.input-area {
    display: flex;
    padding: 15px;
    background-color: rgba(241, 243, 245, 0.5);
    border-top: 1px solid rgba(224, 224, 224, 0.5);
    backdrop-filter: blur(5px);
}

#user-input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid rgba(221, 221, 221, 0.5);
    border-radius: 20px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.3s;
    background-color: rgba(255, 255, 255, 0.8);
}

#user-input:focus {
    border-color: #3498db;
}

#send-button {
    margin-left: 10px;
    padding: 12px 20px;
    background-color: rgba(44, 62, 80, 0.8);
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s;
    backdrop-filter: blur(5px);
}

#send-button:hover {
    background-color: rgba(52, 152, 219, 0.8);
}

#send-button:disabled {
    background-color: rgba(149, 165, 166, 0.5);
    cursor: not-allowed;
}

.typing-indicator {
    align-self: flex-start;
    background-color: rgba(255, 255, 255, 0.7);
    color: #777;
    padding: 12px 16px;
    border-radius: 18px;
    border: 1px solid rgba(224, 224, 224, 0.5);
    display: none;
    margin-bottom: 10px;
    backdrop-filter: blur(5px);
}

.typing-indicator span {
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: #777;
    border-radius: 50%;
    margin: 0 2px;
    animation: bounce 1.3s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.15s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.voice-controls {
    display: flex;
    padding: 10px 15px;
    background-color: rgba(241, 243, 245, 0.5);
    border-top: 1px solid rgba(224, 224, 224, 0.5);
    gap: 10px;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.voice-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 12px;
    background-color: rgba(44, 62, 80, 0.8);
    color: white;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
    backdrop-filter: blur(5px);
}

.voice-btn:hover:not(:disabled) {
    background-color: rgba(52, 152, 219, 0.8);
    transform: translateY(-2px);
}

.voice-btn:disabled {
    background-color: rgba(149, 165, 166, 0.5);
    cursor: not-allowed;
    transform: none;
}

.tts-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    margin-left: 10px;
    opacity: 0.7;
    transition: opacity 0.3s;
    padding: 5px;
}

.tts-btn:hover {
    opacity: 1;
}

.speaking {
    position: relative;
}

.speaking::after {
    content: "";
    position: absolute;
    right: -20px;
    top: 50%;
    transform: translateY(-50%);
    width: 15px;
    height: 15px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%235c6bc0'%3E%3Cpath d='M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@media (max-width: 768px) {
    .container {
        margin: 10px;
        width: calc(100% - 20px);
    }
    
    .message {
        max-width: 90%;
    }
    
    .voice-controls {
        flex-wrap: wrap;
    }
}